package io.netty.test.main.heartbeat;


import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.timeout.IdleStateHandler;

import java.util.concurrent.TimeUnit;

/**
 * Created by LuoYu on 2019/2/9.
 */
public class HeartbeatInitializer  extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ch.pipeline()
            .addLast(new IdleStateHandler(5,7,10,TimeUnit.SECONDS))
            .addLast(new HeartbeatHandler());
    }
}
